/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			CstActMdl.cc
  \date			June 2011
  \author		TNick

  \brief		Contains the implementation for CstActMdl class


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @n
 Please read ReadMe.txt and Licence.txt in root folder @n
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @n

*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<base/CC_App.h>

#include	"cst_actmdl.h"

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

/* ------------------------------------------------------------------------- */
QVariant				CstActMdl::data		(
	const QModelIndex & midx, int role ) const
{

	return QVariant();
	if (!midx.isValid())
		return QVariant();

	CstAct* it_a = static_cast<CstAct*>(midx.internalPointer());
	if (it_a == NULL)
		return QVariant();


	if (role == Qt::DisplayRole)
		{
			switch (midx.column())
				{
				case	(0): {
						return it_a->shortDescr();
					}
				case	(1): {
						return it_a->commandStr();
					}
				case	(2): {
						return it_a->longDescr();
					}
				}
		}
	else if (role == Qt::DecorationRole)
		{
			if (midx.column() == 0)
				{
					return QIcon(it_a->icon());
				}
		}
	return QVariant();

}
/* ========================================================================= */

/* ------------------------------------------------------------------------- */
bool						CstActMdl::setData			(const QModelIndex &midx,
														 const QVariant &value, int role)
{
	if (midx.isValid())
		return false;
	if (!isEditable())
		return false;

	CstAct* it_a = static_cast<CstAct*>(midx.internalPointer());
	if (role == Qt::DisplayRole)
		{
			switch (midx.column())
				{
				case	(0): {
						it_a->setShortDescr(value.toString());
					}
				case	(1): {
						it_a->setCommandStr(value.toString());
					}
				case	(2): {
						it_a->setLongDescr(value.toString());
					}
				default:{
						return false;
					}
				}
			return true;
		}
	return false;

}
/* ========================================================================= */


/*  CLASS    =============================================================== */
//
//
//
//
/* ------------------------------------------------------------------------- */
/* ========================================================================= */

